package sjtu;

import java.util.Scanner;
/**
 * n + 1, m = 0
 * 
 * A(m - 1, 1), m ≠ 0, n = 0
 * 
 * A(m - 1, A(m, n - 1)), m ≠ 0, n ≠ 0
 * 
 * @author chenxiaokang
 *
 */
public class Sjtu1032 {
	public static void main(String[] args) {
		new Sjtu1032().go();
	}
	
	public int ac(int m,int n){
		if(m == 0){
			return n + 1;
		}else if(n == 0){
			return this.ac(m - 1, 1);
		}else{
			return this.ac(m - 1, this.ac(m, n - 1));
		}
	}
	
	public void go(){
		Scanner scan = new Scanner(System.in);
		int n,m;
		while(scan.hasNext()){
			m = scan.nextInt();
			n = scan.nextInt();
			System.out.println(this.ac(m, n));
		}
	}
}
